import { Geist, Geist_Mono } from "next/font/google";
import { Cormorant_Garamond } from "next/font/google";

import "./globals.css";
import "antd/dist/reset.css";
import { UserProvider } from "./context/userContext";
import { ConfigProvider } from "antd";
import LeafFall from "@/components/LeafFall";
import Background from "@/components/Background"; // 引入新的背景组件

const geistSans = Geist({
  variable: "--font-geist-sans",
  subsets: ["latin"],
});

const geistMono = Geist_Mono({
  variable: "--font-geist-mono",
  subsets: ["latin"],
});

const cormorant = Cormorant_Garamond({
  weight: ["400", "600", "700"],
  subsets: ["latin"],
  variable: "--font-cormorant",
});

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html
      lang="zh"
      className={`${geistSans.variable} ${geistMono.variable} ${cormorant.variable}`}
    >
      <body className="antialiased relative">
        {/* 动态背景放在最底层 */}
        <div className="absolute inset-0 pointer-events-none -z-20">
          <Background />
        </div>

        {/* 叶子飘落动画放中间层 */}
        <div className="absolute inset-0 pointer-events-none -z-10">
          <LeafFall />
        </div>

        {/* 内容层，保证最高层级 */}
        <div className="morandi-content relative z-20">
          <UserProvider>
            <ConfigProvider>{children}</ConfigProvider>
          </UserProvider>
        </div>
      </body>
    </html>
  );
}
